﻿using System.Collections;
using System.Collections.Generic;
using Xunit;

namespace Unity.String.Tests
{
    public class ReadOnlyListAdaptorTest
    {
        [Fact]
        public void MethodsTest()
        {
            List<int> testIntList = new List<int>(10) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
            ReadOnlyListAdaptor<int> testIntListAdaptor = new ReadOnlyListAdaptor<int>(testIntList);
            Assert.Equal(testIntList.Count, testIntListAdaptor.Count);
            for (int index = 0; index < testIntList.Count; index++)
            {
                Assert.Equal(index, testIntListAdaptor[index]);
            }

            IEnumerator<int> testIntIEnumerator = testIntListAdaptor.GetEnumerator();
            while (testIntIEnumerator.MoveNext())
            {
                int currentTestValue = testIntIEnumerator.Current;
                Assert.True(currentTestValue >= 0);
            }
            testIntIEnumerator.Dispose();

            foreach (int testListValue in (IEnumerable) testIntListAdaptor)
            {
                Assert.True(testListValue >= 0);
            }
        }
    }
}